home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2007 December
/
PCWKCD1207B.iso
/
Windows marzen
/
Macro ToolsWorks 6.31
/
tworks.exe
/
Samples
/
Parse full file path to components.mcr
< prev
next >
Wrap
Text File
|
2003-06-10
|
1KB
|
40 lines
<#>
<#> Parse full file path to drive, directory and file name components
<#>
<cmds>
<var_oper>(vInputFile,"",SELECT_FILE,"Select File","", "0")
<if_str>("_vCanceled==1")<exitmacro><endif>
<var_parse>("vInputFile",":\","",vFilePathComponents,vNumOfFilePathComponents)
<var_oper>(vNumOfFilePathComponents,"%vNumOfFilePathComponents%-1",CALC_EXPRESSION,"0","", "0")
<#> File Name:
<varset>("vOutput_FileName=vFilePathComponents[vNumOfFilePathComponents]","")
<var_oper>(vNumOfFilePathComponents,"%vNumOfFilePathComponents%-1",CALC_EXPRESSION,"0","", "0")
<#> Drive Letter:
<varset>("vOutput_Drive=vFilePathComponents[0]","")
<var_oper>(vTemp,"%vOutput_Drive%",STR_LENGTH,"","", "0")
<if_num>("vTemp>1")
<#> This is network path like \\server\directory\,,,\
<varset>("vOutput_Drive=\\%vOutput_Drive%\","")
<else>
<#> This is local path like c:\directory\,,,\
<varset>("vOutput_Drive=%vOutput_Drive%:\","")
<endif>
<#> Directory:
<varset>("vOutput_Directory=_vStrEmpty","")
<begloop>(vNumOfFilePathComponents)
<var_oper>(vOutput_Directory,"%vOutput_Directory%",STR_APPEND,"%vFilePathComponents[_vLoopCounter]%\","", "0")
<endloop>
<msg>(-100,-100,"Original file: %vInputFile%
Drive: %vOutput_Drive%
Directory path: %vOutput_Directory%
File name: %vOutput_FileName%","Message",1)